package com.jycode.commons.model;

// Generated 2008-2-21 11:26:43 by Hibernate Tools 3.2.0.b9

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.jycode.commons.model.base.CmsBaseEntity;


/**
 * Catalog generated by hbm2java
 */
@Entity
@Table(name = "CMS_CATALOG", catalog = "TEST")
@SuppressWarnings("serial")
public class CmsCatalog extends CmsBaseEntity implements
		java.io.Serializable {

	private long id;
	private String name;
	private boolean enable = true;
    private CmsCatalog cmsCatalog;
    private Set<CmsCatalog> cmsCatalogs = new HashSet<CmsCatalog>(0);


	public CmsCatalog() {
		this.id = 0;
	}

	public CmsCatalog(long id) {
		this.id = id;
	}

	public CmsCatalog(long id, String name) {
		this.id = id;
		this.name = name;
	}

	public CmsCatalog(long id, boolean enable) {
        this.id = id;
        this.enable = enable;
    }

	public CmsCatalog(long id, CmsCatalog cmsCatalog, String name, boolean enable, Set<CmsCatalog> cmsCatalogs) {
       this.id = id;
       this.cmsCatalog = cmsCatalog;
       this.name = name;
       this.enable = enable;
       this.cmsCatalogs = cmsCatalogs;
    }

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "ID", unique = true, nullable = false)
	public long getId() {
		return this.id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Column(name = "NAME")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

    @Column(name="ENABLE", nullable=false)
    public boolean isEnable() {
        return this.enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }


//	@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, targetEntity=CmsCatalog.class  )
//    @JoinColumn(name="PARENT_ID")
//    public long getParentId() {
//		return parentId;
//	}
//
//	public void setParentId(long parentId) {
//		this.parentId = parentId;
//	}

	@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="PARENT_ID")
    public CmsCatalog getCmsCatalog() {
        return this.cmsCatalog;
    }

    public void setCmsCatalog(CmsCatalog cmsCatalog) {
        this.cmsCatalog = cmsCatalog;
    }

    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="cmsCatalog")
    public Set<CmsCatalog> getCmsCatalogs() {
        return this.cmsCatalogs;
    }

    public void setCmsCatalogs(Set<CmsCatalog> cmsCatalogs) {
        this.cmsCatalogs = cmsCatalogs;
    }


}
